﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using automobili_data;

namespace automobili_gui.UserManagement
{
    public partial class Registracija : System.Web.UI.Page
    {
        User current = null;
        
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void registrationForm_Authenticate(object sender, EventArgs e)
        {


            
             current = automobili_data.AutomobiliDataManager.instance.getUserN(email.Text);
           //  try
            // {
            if (current ==null){
                 automobili_data.AutomobiliDataManager.instance.createUser(ime.Text, prezime.Text, email.Text, lozinka.Text);
                 Response.Redirect(WebSiteController.onSuccessfullyRegisterUrl(), true);
             } else
            // catch (automobili_data.interfaces.exceptions.UserException ue)
             {
                
                  reg.Text= "Vec postoji korisnik";

             }
        }
    }
}